package com.andon.springboot.seed.controller;

import com.andon.springboot.seed.api.ApiResponseUtil;
import com.andon.springboot.seed.entity.DeptEntity;
import com.andon.springboot.seed.param.DeptParam;
import com.andon.springboot.seed.service.IDeptService;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @author: baiwenlong
 * created on: 2018/11/15 5:05 PM
 * description: 部门控制器
 */
@RequestMapping(value = "/seed/")
@Controller
public class DeptController {

    @Resource
    private IDeptService iDeptService;

    /**
     * 查询部门
     */
    @ResponseBody
    @GetMapping(value = "findDept")
    public ApiResponseUtil<DeptEntity> findDept(@RequestParam(value = "deptId") Integer deptId) {
        return iDeptService.selectDeptById(deptId);
    }

    @ResponseBody
    @PostMapping(value = "saveDept")
    public ApiResponseUtil<String> saveDept( DeptParam deptParam) {
        return iDeptService.saveDept(deptParam);
    }
}
